![]() |
WOLF core
WOLF: A Modular Estimation Framework for Robotics
|
Matrix of tracked features, by track and by snapshot (Captures or time stamps) This class implements the following data structure: More...
#include <core/processor/track_matrix.h>
Public Member Functions | |
| TrackMatrix () | |
| Default constructor. More... | |
| virtual | ~TrackMatrix () |
| Destructor. More... | |
| void | newTrack (FeatureBasePtr _ftr) |
| Creates a new track with a feature. More... | |
| void | add (const SizeStd &_track_id, const FeatureBasePtr &_ftr) |
| Adds a feature (linked to a capture) to an existing track, setting its track id. More... | |
| void | add (const FeatureBasePtr &_ftr_existing, const FeatureBasePtr &_ftr_new) |
| Adds a feature to the track of an existing feature. More... | |
| void | remove (FeatureBasePtr _ftr) |
| Removes a feature from its track and snapshot. More... | |
| void | remove (const SizeStd &_track_id) |
| Removes a track and its features from all snapshots. More... | |
| void | remove (CaptureBasePtr _cap) |
| Removes the snapshot of a capture and its features from all tracks. More... | |
| SizeStd | numTracks () const |
| Returns the number of tracks. More... | |
| SizeStd | trackSize (const SizeStd &_track_id) const |
| Returns the number of features of a track. More... | |
| TrackConst | track (const SizeStd &_track_id) const |
| Returns a track: its features indexed by time stamp. More... | |
| Track | track (const SizeStd &_track_id) |
| Returns a track: its features indexed by time stamp. More... | |
| SnapshotConst | snapshot (CaptureBaseConstPtr _capture) const |
| Returns the snapshot of a capture: its features indexed by track id. More... | |
| Snapshot | snapshot (CaptureBasePtr _capture) |
| Returns the snapshot of a capture: its features indexed by track id. More... | |
| vector< FeatureBaseConstPtr > | trackAsVector (const SizeStd &_track_id) const |
| Returns the features of a track as a vector, ordered by time stamp. More... | |
| vector< FeatureBasePtr > | trackAsVector (const SizeStd &_track_id) |
| Returns the features of a track as a vector, ordered by time stamp. More... | |
| FeatureBaseConstPtrList | snapshotAsList (CaptureBaseConstPtr _cap) const |
| Returns the features of the snapshot of a capture as a list. More... | |
| FeatureBasePtrList | snapshotAsList (CaptureBasePtr _cap) |
| Returns the features of the snapshot of a capture as a list. More... | |
| TrackMatchesConst | matches (CaptureBaseConstPtr _cap_1, CaptureBaseConstPtr _cap_2) const |
| Returns the pairs of features of two captures in the same track, indexed by track id. More... | |
| TrackMatches | matches (CaptureBasePtr _cap_1, CaptureBasePtr _cap_2) |
| Returns the pairs of features of two captures in the same track, indexed by track id. More... | |
| FeatureBaseConstPtr | firstFeature (const SizeStd &_track_id) const |
| Returns the oldest feature of a track. More... | |
| FeatureBasePtr | firstFeature (const SizeStd &_track_id) |
| Returns the oldest feature of a track. More... | |
| FeatureBaseConstPtr | lastFeature (const SizeStd &_track_id) const |
| Returns the newest feature of a track. More... | |
| FeatureBasePtr | lastFeature (const SizeStd &_track_id) |
| Returns the newest feature of a track. More... | |
| FeatureBaseConstPtr | feature (const SizeStd &_track_id, CaptureBaseConstPtr _cap) const |
| Returns the feature of a track in a capture. More... | |
| FeatureBasePtr | feature (const SizeStd &_track_id, CaptureBasePtr _cap) |
| Returns the feature of a track in a capture. More... | |
| CaptureBaseConstPtr | firstCapture (const SizeStd &_track_id) const |
| Returns the capture of the oldest feature of a track. More... | |
| CaptureBasePtr | firstCapture (const SizeStd &_track_id) |
| Returns the capture of the oldest feature of a track. More... | |
| CaptureBaseConstPtr | lastCapture (const SizeStd &_track_id) const |
| Returns the capture of the newest feature of a track. More... | |
| CaptureBasePtr | lastCapture (const SizeStd &_track_id) |
| Returns the capture of the newest feature of a track. More... | |
| list< SizeStd > | trackIds (CaptureBaseConstPtr _capture=nullptr) const |
| Returns the ids of the tracks of a capture snapshot (all tracks if nullptr) More... | |
| CaptureBaseConstPtrList | captures () const |
| Returns the captures of all snapshots, ordered by time stamp. More... | |
| CaptureBasePtrList | captures () |
| Returns the captures of all snapshots, ordered by time stamp. More... | |
| CaptureBaseConstPtr | capture (const TimeStamp &_ts, const double &_time_tolerance) const |
| Returns the capture of the snapshot closest to a time stamp, within a time tolerance. More... | |
| CaptureBasePtr | capture (const TimeStamp &_ts, const double &_time_tolerance) |
| Returns the capture of the snapshot closest to a time stamp, within a time tolerance. More... | |
| TrackConst | trackAtKeyframes (const SizeStd &_track_id) const |
| Returns the features of a track whose captures belong to a keyframe (in the problem) More... | |
| Track | trackAtKeyframes (const SizeStd &_track_id) |
| Returns the features of a track whose captures belong to a keyframe (in the problem) More... | |
| void | cleanSnapshots () |
| Removes the snapshots of the captures being removed (e.g. when a keyframe is removed) More... | |
Matrix of tracked features, by track and by snapshot (Captures or time stamps) This class implements the following data structure:
Snapshots at each capture Cx: C1 C2 C3 C4 C5 Tracks for each matched feature: f1 — f3 — f7 — f11 – f14 <– track 1, of corresponding features in different captures | | | | | | f4 — f8 — f12 – f15 <– track 2 | | | | | f5 — f9 — f13 <– track 3 | | | f2 — f6 — f10 <– track 4
Each 'f' is a feature pointer of the type FeatureBasePtr
This structure allows accessing all the history of matched features with two different accesses:
Track: track-wise: a track of features matches along a timely sequence of Captures, indexed by time stamp.
map<TimeStamp ts, FeatureBasePtr f>
Snapshot: capture-wise: a set of features tracked in a single Capture, indexed by track id:
map<SizeStd track_id, FeatureBasePtr f>
The class makes sure that both accesses are consistent each time some addition or removal of features is performed.
The storage is implemented as two maps of maps, so each addition and removal of single features is accomplished in logarithmic time:
Tracks are identified with the track ID in f->trackId() Snapshots are identified with the Capture pointer in f->getCapture()
the track ID of FeatureBase is set each time a feature (already linked to its capture) is added to the track matrix:
add(track_id, f) will set f.track_id = track_id.
so e.g. given a feature f,
track (f->trackId()) ; // returns all the track where feature f is. snapshot(f->getCapture()) ; // returns all the features in the same capture of f.
| wolf::TrackMatrix::TrackMatrix | ( | ) |
Default constructor.
|
virtual |
Destructor.
| void wolf::TrackMatrix::add | ( | const FeatureBasePtr & | _ftr_existing, |
| const FeatureBasePtr & | _ftr_new | ||
| ) |
Adds a feature to the track of an existing feature.
| void wolf::TrackMatrix::add | ( | const SizeStd & | _track_id, |
| const FeatureBasePtr & | _ftr | ||
| ) |
Adds a feature (linked to a capture) to an existing track, setting its track id.
| CaptureBasePtr wolf::TrackMatrix::capture | ( | const TimeStamp & | _ts, |
| const double & | _time_tolerance | ||
| ) |
Returns the capture of the snapshot closest to a time stamp, within a time tolerance.
| _ts | the time stamp |
| _time_tolerance | the maximum time difference |
| CaptureBaseConstPtr wolf::TrackMatrix::capture | ( | const TimeStamp & | _ts, |
| const double & | _time_tolerance | ||
| ) | const |
Returns the capture of the snapshot closest to a time stamp, within a time tolerance.
| _ts | the time stamp |
| _time_tolerance | the maximum time difference |
| CaptureBasePtrList wolf::TrackMatrix::captures | ( | ) |
Returns the captures of all snapshots, ordered by time stamp.
| CaptureBaseConstPtrList wolf::TrackMatrix::captures | ( | ) | const |
Returns the captures of all snapshots, ordered by time stamp.
| void wolf::TrackMatrix::cleanSnapshots | ( | ) |
Removes the snapshots of the captures being removed (e.g. when a keyframe is removed)
| FeatureBaseConstPtr wolf::TrackMatrix::feature | ( | const SizeStd & | _track_id, |
| CaptureBaseConstPtr | _cap | ||
| ) | const |
Returns the feature of a track in a capture.
| FeatureBasePtr wolf::TrackMatrix::feature | ( | const SizeStd & | _track_id, |
| CaptureBasePtr | _cap | ||
| ) |
Returns the feature of a track in a capture.
| CaptureBasePtr wolf::TrackMatrix::firstCapture | ( | const SizeStd & | _track_id | ) |
Returns the capture of the oldest feature of a track.
| CaptureBaseConstPtr wolf::TrackMatrix::firstCapture | ( | const SizeStd & | _track_id | ) | const |
Returns the capture of the oldest feature of a track.
| FeatureBasePtr wolf::TrackMatrix::firstFeature | ( | const SizeStd & | _track_id | ) |
Returns the oldest feature of a track.
| FeatureBaseConstPtr wolf::TrackMatrix::firstFeature | ( | const SizeStd & | _track_id | ) | const |
Returns the oldest feature of a track.
| CaptureBasePtr wolf::TrackMatrix::lastCapture | ( | const SizeStd & | _track_id | ) |
Returns the capture of the newest feature of a track.
| CaptureBaseConstPtr wolf::TrackMatrix::lastCapture | ( | const SizeStd & | _track_id | ) | const |
Returns the capture of the newest feature of a track.
| FeatureBasePtr wolf::TrackMatrix::lastFeature | ( | const SizeStd & | _track_id | ) |
Returns the newest feature of a track.
| FeatureBaseConstPtr wolf::TrackMatrix::lastFeature | ( | const SizeStd & | _track_id | ) | const |
Returns the newest feature of a track.
| TrackMatchesConst wolf::TrackMatrix::matches | ( | CaptureBaseConstPtr | _cap_1, |
| CaptureBaseConstPtr | _cap_2 | ||
| ) | const |
Returns the pairs of features of two captures in the same track, indexed by track id.
| TrackMatches wolf::TrackMatrix::matches | ( | CaptureBasePtr | _cap_1, |
| CaptureBasePtr | _cap_2 | ||
| ) |
Returns the pairs of features of two captures in the same track, indexed by track id.
| void wolf::TrackMatrix::newTrack | ( | FeatureBasePtr | _ftr | ) |
Creates a new track with a feature.
| SizeStd wolf::TrackMatrix::numTracks | ( | ) | const |
Returns the number of tracks.
| void wolf::TrackMatrix::remove | ( | CaptureBasePtr | _cap | ) |
Removes the snapshot of a capture and its features from all tracks.
| void wolf::TrackMatrix::remove | ( | const SizeStd & | _track_id | ) |
Removes a track and its features from all snapshots.
| void wolf::TrackMatrix::remove | ( | FeatureBasePtr | _ftr | ) |
Removes a feature from its track and snapshot.
| SnapshotConst wolf::TrackMatrix::snapshot | ( | CaptureBaseConstPtr | _capture | ) | const |
Returns the snapshot of a capture: its features indexed by track id.
| Snapshot wolf::TrackMatrix::snapshot | ( | CaptureBasePtr | _capture | ) |
Returns the snapshot of a capture: its features indexed by track id.
| FeatureBaseConstPtrList wolf::TrackMatrix::snapshotAsList | ( | CaptureBaseConstPtr | _cap | ) | const |
Returns the features of the snapshot of a capture as a list.
| FeatureBasePtrList wolf::TrackMatrix::snapshotAsList | ( | CaptureBasePtr | _cap | ) |
Returns the features of the snapshot of a capture as a list.
Returns a track: its features indexed by time stamp.
| TrackConst wolf::TrackMatrix::track | ( | const SizeStd & | _track_id | ) | const |
Returns a track: its features indexed by time stamp.
| vector< FeatureBasePtr > wolf::TrackMatrix::trackAsVector | ( | const SizeStd & | _track_id | ) |
Returns the features of a track as a vector, ordered by time stamp.
| vector< FeatureBaseConstPtr > wolf::TrackMatrix::trackAsVector | ( | const SizeStd & | _track_id | ) | const |
Returns the features of a track as a vector, ordered by time stamp.
Returns the features of a track whose captures belong to a keyframe (in the problem)
| TrackConst wolf::TrackMatrix::trackAtKeyframes | ( | const SizeStd & | _track_id | ) | const |
Returns the features of a track whose captures belong to a keyframe (in the problem)
| list< SizeStd > wolf::TrackMatrix::trackIds | ( | CaptureBaseConstPtr | _capture = nullptr | ) | const |
Returns the ids of the tracks of a capture snapshot (all tracks if nullptr)
Returns the number of features of a track.